﻿using System;
using System.Collections.Generic;

namespace MyLib.Data {
	/// <summary>
	/// Table of user.
	/// </summary>
	[System.ComponentModel.DesignerCategory("Code")]
	public class SysLogTable : System.Data.DataTable, System.Collections.Generic.IList<SysLogRow> {
		/// <summary>
		/// 
		/// </summary>
		public const int ColumnLogId = 0;

		/// <summary>
		/// 
		/// </summary>
		public const int ColumnOperatorId = 1;

		/// <summary>
		/// 
		/// </summary>
		public const int ColumnOperatorName = 2;

		/// <summary>
		/// 
		/// </summary>
		public const int ColumnOperation = 3;

		/// <summary>
		/// 
		/// </summary>
		public const int ColumnOperandId = 4;

		/// <summary>
		/// 
		/// </summary>
		public const int ColumnOperandName = 5;

		/// <summary>
		/// 
		/// </summary>
		public const int ColumnDatePoint = 6;

		/// <summary>
		/// 
		/// </summary>
		public const int ColumnRemark = 7;

		/// <summary>
		/// Create a new instance of SysLogTable.
		/// </summary>
		protected override System.Data.DataTable CreateInstance() {
			return new SysLogTable();
		}

		/// <summary>
		/// Create as new instance of SysLogRow.
		/// </summary>
		/// <param name="builder">Builder for data row.</param>
		protected override System.Data.DataRow NewRowFromBuilder(System.Data.DataRowBuilder builder) {
			return new SysLogRow(builder);
		}

		/// <summary>
		/// Count of rows.
		/// </summary>
		public int Count {
			get {
				return base.Rows.Count;
			}
		}

		/// <summary>
		/// Get row.
		/// </summary>
		/// <param name="index">Index of row.</param>
		public SysLogRow this[int index] {
			get {
				return (SysLogRow)(base.Rows[index]);
			}
			set {
				throw new System.NotImplementedException();
			}
		}

		/// <summary>
		/// Add a row.
		/// </summary>
		/// <param name="row" >Row which will be added.</param>
		public void AddRow(SysLogRow row) {
			base.Rows.Add(row);
		}

		/// <summary>
		/// Remove a row.
		/// </summary>
		/// <param name="row" >Row which will be removed.</param>
		public void RemoveRow(SysLogRow row) {
			base.Rows.Remove(row);
		}

		/// <summary>
		/// Add a new row with default values.
		/// </summary>
		public SysLogRow AddNewRow() {
			var row = base.NewRow() as SysLogRow;

			System.Diagnostics.Debug.Assert(row != null);

			base.Rows.Add(row);

			return row;
		}

		/// <summary>
		/// Type of data row.
		/// </summary>
		protected override System.Type GetRowType() {
			return typeof(SysLogRow);
		}

		#region Members of System.Collections.Generic.IEnumerable<SysLogRow>.

		/// <summary>
		/// 
		/// </summary>
		/// <param name="item"></param>
		/// <returns></returns>
		public int IndexOf(SysLogRow item) {
			return base.Rows.IndexOf(item);
		}

		/// <summary>
		///
		/// </summary>
		/// <param name="index" ></param>
		/// <param name="item" ></param>
		public void Insert(int index, SysLogRow item) {
			base.Rows.InsertAt(item, index);
		}

		/// <summary>
		///
		/// </summary>
		/// <param name="index"></param>
		public void RemoveAt(int index) {
			base.Rows.RemoveAt(index);
		}

		/// <summary>
		///
		/// </summary>
		/// <param name="item" ></param>
		public void Add(SysLogRow item) {
			base.Rows.Add(item);
		}

		/// <summary>
		/// 
		/// </summary>
		/// <param name="item" ></param>
		/// <returns></returns>
		bool System.Collections.Generic.ICollection<SysLogRow>.Contains(SysLogRow item) {
			throw new System.NotImplementedException();
		}

		/// <summary>
		///
		/// </summary>
		/// <param name="keys" ></param>
		/// <returns></returns>
		public bool ContainsKey(params object[] keys) {
			System.Diagnostics.Debug.Assert(keys != null);
			System.Diagnostics.Debug.Assert(keys.Length != 0);

			return base.Rows.Contains(keys);
		}

		/// <summary>
		/// 
		/// </summary>
		/// <param name="array" ></param>
		/// <param name="arrayIndex" ></param>
		public void CopyTo(SysLogRow[] array, int arrayIndex) {
			base.Rows.CopyTo(array, arrayIndex);
		}

		/// <summary>
		/// 
		/// </summary>
		public bool IsReadOnly {
			get {
				return false;
			}
		}

		/// <summary>
		/// 
		/// </summary>
		/// <param name="item" ></param>
		/// <returns></returns>
		public bool Remove(SysLogRow item) {
			base.Rows.Remove(item);
			return true;
		}

		/// <summary>
		/// 
		/// </summary>
		/// <returns ></returns>
		public IEnumerator<SysLogRow> GetEnumerator() {
			var iter = base.Rows.GetEnumerator();
			while (iter.MoveNext()) {
				yield return iter.Current as SysLogRow;
			}
		}

		/// <summary>
		/// 
		/// </summary>
		/// <returns ></returns>
		System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() {
			return base.Rows.GetEnumerator();
		}

		#endregion

		/// <summary>
		/// Initialize data table.
		/// </summary>
		public SysLogTable() {
			this.TableName = "SysLogTable";
			this.BeginInit();
			var column0 = new System.Data.DataColumn("logId", typeof(int), null, System.Data.MappingType.Attribute);
			column0.Unique = true;
			base.Columns.Add(column0);
			var column1 = new System.Data.DataColumn("operatorId", typeof(string), null, System.Data.MappingType.Attribute);
			base.Columns.Add(column1);
			var column2 = new System.Data.DataColumn("operatorName", typeof(string), null, System.Data.MappingType.Attribute);
			column2.DefaultValue = "";
			base.Columns.Add(column2);
			var column3 = new System.Data.DataColumn("operation", typeof(int), null, System.Data.MappingType.Attribute);
			base.Columns.Add(column3);
			var column4 = new System.Data.DataColumn("operandId", typeof(string), null, System.Data.MappingType.Attribute);
			base.Columns.Add(column4);
			var column5 = new System.Data.DataColumn("operandName", typeof(string), null, System.Data.MappingType.Attribute);
			column5.DefaultValue = "";
			base.Columns.Add(column5);
			var column6 = new System.Data.DataColumn("datepoint", typeof(DateTime), null, System.Data.MappingType.Attribute);
			base.Columns.Add(column6);
			var column7 = new System.Data.DataColumn("remark", typeof(string), null, System.Data.MappingType.Attribute);
			column7.DefaultValue = "";
			base.Columns.Add(column7);
			base.PrimaryKey = new System.Data.DataColumn[] 
            { 
                column0 
            };
			this.EndInit();
		}
	} // end of SysLogTable.

	/// <summary>
	/// SysLogRow.
	/// </summary>
	[System.ComponentModel.DesignerCategory("Code")]
	public class SysLogRow : System.Data.DataRow {
		/// <summary>
		/// Initialize data row.
		/// </summary>
		public SysLogRow(System.Data.DataRowBuilder builder)
			: base(builder) {
		}

		/// <summary>
		/// 
		/// </summary>
		public string LogId {
			get {
				var col = base.Table.Columns[SysLogTable.ColumnLogId];

				if (base.IsNull(col)) {
					throw new System.NullReferenceException("Value of SysLogTable[\"logId\"] is null!");
				} else {
					return (string)(base[col]);
				}
			}
			set {
				var col = base.Table.Columns[SysLogTable.ColumnLogId];

				base[col] = value;
			}
		}

		/// <summary>
		/// 
		/// </summary>
		public void SetLogIdNull() {
			var col = base.Table.Columns[SysLogTable.ColumnLogId];

			base[col] = System.Convert.DBNull;
		}

		/// <summary>
		/// 
		/// </summary>
		public bool IsLogIdNull {
			get {
				var col = base.Table.Columns[SysLogTable.ColumnLogId];

				return base.IsNull(col);
			}
		}

		/// <summary>
		/// 
		/// </summary>
		public string OperatorId {
			get {
				var col = base.Table.Columns[SysLogTable.ColumnOperatorId];

				if (base.IsNull(col)) {
					throw new System.NullReferenceException("Value of SysLogTable[\"operatorId\"] is null!");
				} else {
					return (string)(base[col]);
				}
			}
			set {
				var col = base.Table.Columns[SysLogTable.ColumnOperatorId];

				base[col] = value;
			}
		}

		/// <summary>
		/// 
		/// </summary>
		public void SetOperatorIdNull() {
			var col = base.Table.Columns[SysLogTable.ColumnOperatorId];

			base[col] = System.Convert.DBNull;
		}

		/// <summary>
		/// 
		/// </summary>
		public bool IsOperatorIdNull {
			get {
				var col = base.Table.Columns[SysLogTable.ColumnOperatorId];

				return base.IsNull(col);
			}
		}

		/// <summary>
		/// 
		/// </summary>
		public string OperatorName {
			get {
				var col = base.Table.Columns[SysLogTable.ColumnOperatorName];

				if (base.IsNull(col)) {
					throw new System.NullReferenceException("Value of SysLogTable[\"operatorName\"] is null!");
				} else {
					return (string)(base[col]);
				}
			}
			set {
				var col = base.Table.Columns[SysLogTable.ColumnOperatorName];

				base[col] = value;
			}
		}

		/// <summary>
		/// 
		/// </summary>
		public void SetOperatorNameNull() {
			var col = base.Table.Columns[SysLogTable.ColumnOperatorName];

			base[col] = System.Convert.DBNull;
		}

		/// <summary>
		/// 
		/// </summary>
		public bool IsOperatorNameNull {
			get {
				var col = base.Table.Columns[SysLogTable.ColumnOperatorName];

				return base.IsNull(col);
			}
		}

		/// <summary>
		/// 
		/// </summary>
		public int Operation {
			get {
				var col = base.Table.Columns[SysLogTable.ColumnOperation];

				if (base.IsNull(col)) {
					throw new System.NullReferenceException("Value of SysLogTable[\"operation\"] is null!");
				} else {
					return (int)(base[col]);
				}
			}
			set {
				var col = base.Table.Columns[SysLogTable.ColumnOperation];

				base[col] = value;
			}
		}

		/// <summary>
		/// 
		/// </summary>
		public void SetOperationNull() {
			var col = base.Table.Columns[SysLogTable.ColumnOperation];

			base[col] = System.Convert.DBNull;
		}

		/// <summary>
		/// 
		/// </summary>
		public bool IsOperationNull {
			get {
				var col = base.Table.Columns[SysLogTable.ColumnOperation];

				return base.IsNull(col);
			}
		}

		/// <summary>
		/// 
		/// </summary>
		public string OperandId {
			get {
				var col = base.Table.Columns[SysLogTable.ColumnOperandId];

				if (base.IsNull(col)) {
					throw new System.NullReferenceException("Value of SysLogTable[\"operandId\"] is null!");
				} else {
					return (string)(base[col]);
				}
			}
			set {
				var col = base.Table.Columns[SysLogTable.ColumnOperandId];

				base[col] = value;
			}
		}

		/// <summary>
		/// 
		/// </summary>
		public void SetOperandIdNull() {
			var col = base.Table.Columns[SysLogTable.ColumnOperandId];

			base[col] = System.Convert.DBNull;
		}

		/// <summary>
		/// 
		/// </summary>
		public bool IsOperandIdNull {
			get {
				var col = base.Table.Columns[SysLogTable.ColumnOperandId];

				return base.IsNull(col);
			}
		}

		/// <summary>
		/// 
		/// </summary>
		public string OperandName {
			get {
				var col = base.Table.Columns[SysLogTable.ColumnOperandName];

				if (base.IsNull(col)) {
					throw new System.NullReferenceException("Value of SysLogTable[\"operandName\"] is null!");
				} else {
					return (string)(base[col]);
				}
			}
			set {
				var col = base.Table.Columns[SysLogTable.ColumnOperandName];

				base[col] = value;
			}
		}

		/// <summary>
		/// 
		/// </summary>
		public void SetOperandNameNull() {
			var col = base.Table.Columns[SysLogTable.ColumnOperandName];

			base[col] = System.Convert.DBNull;
		}

		/// <summary>
		/// 
		/// </summary>
		public bool IsOperandNameNull {
			get {
				var col = base.Table.Columns[SysLogTable.ColumnOperandName];

				return base.IsNull(col);
			}
		}

		/// <summary>
		/// 
		/// </summary>
		public DateTime DatePoint {
			get {
				var col = base.Table.Columns[SysLogTable.ColumnDatePoint];

				if (base.IsNull(col)) {
					throw new System.NullReferenceException("Value of SysLogTable[\"datepoint\"] is null!");
				} else {
					return (DateTime)(base[col]);
				}
			}
			set {
				var col = base.Table.Columns[SysLogTable.ColumnDatePoint];

				base[col] = value;
			}
		}

		/// <summary>
		/// 
		/// </summary>
		public void SetDatePointNull() {
			var col = base.Table.Columns[SysLogTable.ColumnDatePoint];

			base[col] = System.Convert.DBNull;
		}

		/// <summary>
		/// 
		/// </summary>
		public bool IsDatePointNull {
			get {
				var col = base.Table.Columns[SysLogTable.ColumnDatePoint];

				return base.IsNull(col);
			}
		}

		/// <summary>
		/// 
		/// </summary>
		public string Remark {
			get {
				var col = base.Table.Columns[SysLogTable.ColumnRemark];

				if (base.IsNull(col)) {
					throw new System.NullReferenceException("Value of SysLogTable[\"remark\"] is null!");
				} else {
					return (string)(base[col]);
				}
			}
			set {
				var col = base.Table.Columns[SysLogTable.ColumnRemark];

				base[col] = value;
			}
		}

		/// <summary>
		/// 
		/// </summary>
		public void SetRemarkNull() {
			var col = base.Table.Columns[SysLogTable.ColumnRemark];

			base[col] = System.Convert.DBNull;
		}

		/// <summary>
		/// 
		/// </summary>
		public bool IsRemarkNull {
			get {
				var col = base.Table.Columns[SysLogTable.ColumnRemark];

				return base.IsNull(col);
			}
		}
	} // end of SysLogRow.
}
